[jboss-svn-commits] JBL Code SVN: r21568 - labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/security.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 15 07:42:50 EDT 2008


Author: jervisliu
Date: 2008-08-15 07:42:50 -0400 (Fri, 15 Aug 2008)
New Revision: 21568

Added:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/security/RoleBasedPermissionManager.java
Log:
Missing one class in my previous commit

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/security/RoleBasedPermissionManager.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/security/RoleBasedPermissionManager.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/security/RoleBasedPermissionManager.java	2008-08-15 11:42:50 UTC (rev 21568)
@@ -0,0 +1,72 @@
+package org.drools.guvnor.server.security;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+import java.util.List;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.security.Identity;
+
+/**
+ * This enhances the BRMS repository for lifecycle management.
+ * @author Chester Woo/Jervis Liu
+ */
+ at Scope(ScopeType.SESSION)
+ at AutoCreate
+ at Name("roleBasedPermissionManager")
+public class RoleBasedPermissionManager {
+    
+//    @In 
+    List<RoleBasedPermission> permissions;
+    
+//    @Unwrap
+    public List<RoleBasedPermission> getRoleBasedPermission() {
+		return permissions;
+	}  
+    
+    @Create
+	public void create() {
+		String userName = "";
+		if (Contexts.isApplicationContextActive()) {
+			userName = Identity.instance().getCredentials().getUsername();
+		}
+
+		RoleBasedPermissionStore pbps = (RoleBasedPermissionStore) Component
+				.getInstance("org.drools.guvnor.server.security.RoleBasedPermissionStore");
+		permissions = pbps.getRoleBasedPermissionsByUserName(Identity
+				.instance().getCredentials().getUsername());
+
+	}
+    
+    @Destroy
+    public void close() {
+        //TO-DO
+    }
+    
+
+    
+}




More information about the jboss-svn-commits mailing list