public static SecurityObjectPermission CreateRolePermission(this ISecurityObjectPermission permission) { SecurityObjectPermission securityOperationPermission = new SecurityObjectPermission(); securityOperationPermission.SetValue(permission); return(securityOperationPermission); }
public static void SetValue(this SecurityObjectPermission operationPermission, IObjectPermission permission) { operationPermission.Operations = permission.Operations; operationPermission.OperationState = permission.OperationState; operationPermission.Type = permission.Type; operationPermission.Criteria = permission.Criteria; }
public static void SetValue(this SecurityObjectPermission operationPermission, ISecurityObjectPermission permission) { operationPermission.Operations = permission.Operations; operationPermission.OperationState = permission.OperationState; CriteriaSerializer criteriaSerializer = new CriteriaSerializer(); // TODO: more checks are needed... operationPermission.Type = ((ParameterExpression)criteriaSerializer.Deserialize(permission.StringType)).Type; operationPermission.Criteria = (LambdaExpression)criteriaSerializer.Deserialize(permission.StringCriteria); }
public virtual IObjectPermission AddObjectPermission <TSource, TargetType>(SecurityOperation operation, OperationState state, Expression <Func <TSource, TargetType, bool> > criteria) where TSource : BaseSecurityDbContext { SecurityObjectPermission objectPermission = new SecurityObjectPermission(); objectPermission.Type = typeof(TargetType); objectPermission.Criteria = criteria; objectPermission.Operations = operation; objectPermission.OperationState = state; this.ObjectPermissions.Add(objectPermission); return(objectPermission); }