public static void createDefaultWildcardPermission( CswNbtResources _CswNbtResources, CswEnumNbtObjectClass PermissionClass, CswPrimaryKey GroupId )
 {
     CswNbtMetaDataObjectClass PermissionOC = _CswNbtResources.MetaData.getObjectClass( PermissionClass );
     CswNbtView PermissionsView = new CswNbtView( _CswNbtResources );
     CswNbtViewRelationship PermissionVR = PermissionsView.AddViewRelationship( PermissionOC, IncludeDefaultFilters: false );
     CswNbtMetaDataObjectClassProp GroupOCP = PermissionOC.getObjectClassProp( PropertyName.PermissionGroup );
     PermissionsView.AddViewPropertyAndFilter( PermissionVR, GroupOCP, Value: GroupId.ToString(), SubFieldName: CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID );
     ICswNbtTree PermissionTree = _CswNbtResources.Trees.getTreeFromView( PermissionsView, false, false, false );
     if( PermissionTree.getChildNodeCount() == 0 )
     {
         CswNbtMetaDataNodeType PermissionNT = PermissionOC.FirstNodeType;
         if( null != PermissionNT )
         {
             _CswNbtResources.Nodes.makeNodeFromNodeTypeId( PermissionNT.NodeTypeId, delegate( CswNbtNode NewNode )
                 {
                     CswNbtPropertySetPermission WildCardPermission = NewNode;
                     WildCardPermission.ApplyToAllRoles.Checked = CswEnumTristate.True;
                     WildCardPermission.ApplyToAllWorkUnits.Checked = CswEnumTristate.True;
                     WildCardPermission.PermissionGroup.RelatedNodeId = GroupId;
                     WildCardPermission.View.Checked = CswEnumTristate.True;
                     WildCardPermission.Edit.Checked = CswEnumTristate.True;
                     WildCardPermission.setWildCardValues();
                 } );
         }
     }
 }
示例#2
0
        /// <summary>
        /// Returns the Permission node (if one exists) for this User for the given Permission GroupId
        /// </summary>
        public CswNbtPropertySetPermission getPermissionForGroup(CswPrimaryKey PermissionGroupId)
        {
            CswNbtPropertySetPermission PermissionNode          = null;
            Dictionary <CswPrimaryKey, CswPrimaryKey> UserPerms = getUserPermissions();

            if (null != UserPerms && UserPerms.ContainsKey(PermissionGroupId))
            {
                CswPrimaryKey PermissionId = UserPerms[PermissionGroupId];
                PermissionNode = _CswNbtResources.Nodes[PermissionId];
            }
            return(PermissionNode);
        }
 /// <summary>
 /// Cast a Permission PropertySet back to an Object Class
 /// </summary>
 public static CswNbtObjClassInventoryGroupPermission fromPropertySet(CswNbtPropertySetPermission PropertySet)
 {
     return(PropertySet.Node);
 }
示例#4
0
 protected override void afterPromoteNodeLogic()
 {
     CswNbtPropertySetPermission.createDefaultWildcardPermission(_CswNbtResources, PermissionClass, NodeId);
 }
 /// <summary>
 /// Cast a Permission PropertySet back to an Object Class
 /// </summary>
 public static CswNbtObjClassMailReportGroupPermission fromPropertySet(CswNbtPropertySetPermission PropertySet)
 {
     return(PropertySet.Node);
 }