public override void update() { //Remove the Modules action permission from every role except ChemSW_Admin string ModuleActionValue = CswNbtObjClassRole.MakeActionPermissionValue( _CswNbtSchemaModTrnsctn.Actions[CswEnumNbtActionName.Modules] ); CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false, true ) ) { if( RoleNode.Name.Text != CswNbtObjClassRole.ChemSWAdminRoleName ) { if( RoleNode.ActionPermissions.CheckValue( ModuleActionValue ) ) { RoleNode.ActionPermissions.RemoveValue( ModuleActionValue ); RoleNode.postChanges( false ); } } else { if( false == RoleNode.ActionPermissions.CheckValue( ModuleActionValue ) ) { RoleNode.ActionPermissions.AddValue( ModuleActionValue ); RoleNode.postChanges( false ); } } } } // update()
public override void update() { // Fix missing role timeouts CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false ) ) { if( Double.IsNaN( RoleNode.Timeout.Value ) ) { RoleNode.Timeout.Value = 30; RoleNode.postChanges( false ); } } } //Update()
public override void update() { CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); CswNbtMetaDataNodeType SiteNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Site" ); if( null != SiteNT ) { foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false, true ) ) { string SiteViewPermissionVal = CswNbtObjClassRole.MakeNodeTypePermissionValue( SiteNT.NodeTypeId, CswEnumNbtNodeTypePermission.View ); if( false == RoleNode.NodeTypePermissions.CheckValue( SiteViewPermissionVal ) ) { RoleNode.NodeTypePermissions.AddValue( SiteViewPermissionVal ); RoleNode.postChanges( false ); } } } } // update()
public override void update() { CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true ) ) { RoleNode.IsDemo = false; RoleNode.postChanges( false ); } CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.UserClass ); foreach( CswNbtObjClassUser UserNode in UserOC.getNodes( false, true ) ) { if( UserNode.IsAdministrator() ) { UserNode.IsDemo = false; UserNode.postChanges( false ); } } CswNbtMetaDataObjectClass InvGrpOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InventoryGroupClass ); foreach( CswNbtNode InvGrpNode in InvGrpOC.getNodes( false, true ) ) { InvGrpNode.IsDemo = false; InvGrpNode.postChanges( false ); } CswNbtMetaDataObjectClass InvGrpPermOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InventoryGroupPermissionClass ); foreach( CswNbtNode InvGrpPermNode in InvGrpPermOC.getNodes( false, true ) ) { InvGrpPermNode.IsDemo = false; InvGrpPermNode.postChanges( false ); } CswNbtMetaDataObjectClass JurisdictionOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.JurisdictionClass ); foreach( CswNbtNode JurisdictionNode in JurisdictionOC.getNodes( false, true ) ) { JurisdictionNode.IsDemo = false; JurisdictionNode.postChanges( false ); } CswNbtMetaDataObjectClass LabelOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.PrintLabelClass ); foreach( CswNbtNode LabelNode in LabelOC.getNodes( false, true ) ) { LabelNode.IsDemo = false; LabelNode.postChanges( false ); } } // update()
public override void update() { //Make all existing Roles timeout prop a max of 90 CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false, true ) ) { if( RoleNode.Timeout.Value > 90 ) { RoleNode.Timeout.Value = 90; RoleNode.postChanges( false ); } } //Make Role.Timeout property Max Value 90 minutes foreach( CswNbtMetaDataNodeType RoleNT in RoleOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp TimeoutNTP = RoleNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRole.PropertyName.Timeout ); TimeoutNTP.MaxValue = 90; } } // update()
public override void update() { //6-8 - update action and view permissions for CIS_Pro roles, and add WelcomePage Items CswNbtLandingPageTable LandingPageObj = _CswNbtSchemaModTrnsctn.getLandingPageTable(); CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, false ) ) { LandingPageData.Request Request; if( RoleNode.Name.Text == "CISPro_Admin" ) { //Actions - edit view, multi-edit, reconcile, sessions, subscriptions _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Edit_View, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Multi_Edit, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Reconciliation, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Sessions, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Subscriptions, RoleNode, true ); //Views (and Welcome Items) - roles and users, reports List<CswNbtView> RolesAndUsersViews = _CswNbtSchemaModTrnsctn.restoreViews( "Roles and Users" ); CswNbtView RolesAndUsersView = null; foreach( CswNbtView View in RolesAndUsersViews ) { if( View.VisibilityRoleId != null || View.ViewVisibility == NbtViewVisibility.Global.ToString() ) { RolesAndUsersView = View; if( RolesAndUsersView.VisibilityRoleId == RoleNode.NodeId ) { break; } } } if( null != RolesAndUsersView ) { if( RolesAndUsersView.VisibilityRoleId != RoleNode.NodeId && RolesAndUsersView.ViewVisibility != NbtViewVisibility.Global.ToString() ) { RolesAndUsersView = _CswNbtSchemaModTrnsctn.makeNewView( "Roles and Users", RolesAndUsersView.Visibility, RoleNode.NodeId, null, RolesAndUsersView.ViewId.get()); RolesAndUsersView.save(); } Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = RolesAndUsersView.ViewId.ToString(), NodeTypeId = String.Empty, Text = RolesAndUsersView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 1 }; LandingPageObj.addLandingPageItem( Request ); } List<CswNbtView> ReportsViews = _CswNbtSchemaModTrnsctn.restoreViews( "Reports" ); CswNbtView ReportsView = null; foreach( CswNbtView View in ReportsViews ) { if( View.VisibilityRoleId != null || View.ViewVisibility == NbtViewVisibility.Global.ToString() ) { ReportsView = View; if( ReportsView.VisibilityRoleId == RoleNode.NodeId ) { break; } } } if( null != ReportsView ) { if( ReportsView.VisibilityRoleId != RoleNode.NodeId && ReportsView.ViewVisibility != NbtViewVisibility.Global.ToString() ) { ReportsView = _CswNbtSchemaModTrnsctn.makeNewView( "Reports", ReportsView.Visibility, RoleNode.NodeId, null, ReportsView.ViewId.get() ); ReportsView.save(); } Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = ReportsView.ViewId.ToString(), NodeTypeId = String.Empty, Text = ReportsView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 2 }; LandingPageObj.addLandingPageItem( Request ); } //WelcomeItems - work units, vendors, UOM, Locations, Inventory Groups, Regulatory Listss CswNbtView LocationsView = _CswNbtSchemaModTrnsctn.restoreView( "Locations", NbtViewVisibility.Global ); if( null != LocationsView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = LocationsView.ViewId.ToString(), NodeTypeId = String.Empty, Text = LocationsView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 3 }; LandingPageObj.addLandingPageItem( Request ); } CswNbtView VendorsView = _CswNbtSchemaModTrnsctn.restoreView( "Vendors", NbtViewVisibility.Global ); if( null != VendorsView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = VendorsView.ViewId.ToString(), NodeTypeId = String.Empty, Text = VendorsView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 2, NewColumn = 1 }; LandingPageObj.addLandingPageItem( Request ); } CswNbtView WorkUnitsView = _CswNbtSchemaModTrnsctn.restoreView( "Work Units", NbtViewVisibility.Global ); if( null != WorkUnitsView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = WorkUnitsView.ViewId.ToString(), NodeTypeId = String.Empty, Text = WorkUnitsView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 2, NewColumn = 2 }; LandingPageObj.addLandingPageItem( Request ); } CswNbtView InventoryGroupsView = _CswNbtSchemaModTrnsctn.restoreView( "Inventory Groups", NbtViewVisibility.Global ); if( null != InventoryGroupsView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = InventoryGroupsView.ViewId.ToString(), NodeTypeId = String.Empty, Text = InventoryGroupsView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 2, NewColumn = 3 }; LandingPageObj.addLandingPageItem( Request ); } CswNbtView UoMView = _CswNbtSchemaModTrnsctn.restoreView( "Units of Measurement", NbtViewVisibility.Global ); if( null != UoMView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = UoMView.ViewId.ToString(), NodeTypeId = String.Empty, Text = UoMView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 3, NewColumn = 1 }; LandingPageObj.addLandingPageItem( Request ); } CswNbtView RegListsView = _CswNbtSchemaModTrnsctn.restoreView( "Regulatory Lists", NbtViewVisibility.Role ); if( null != RegListsView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = RegListsView.ViewId.ToString(), NodeTypeId = String.Empty, Text = RegListsView.ViewName, RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 3, NewColumn = 2 }; LandingPageObj.addLandingPageItem( Request ); } RoleNode.postChanges( false ); } else if( RoleNode.Name.Text == "CISPro_General" ) { //Actions - edit view, multi-edit, subscriptions _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Edit_View, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Multi_Edit, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Subscriptions, RoleNode, true ); //WelcomeItems - My Containers, My Expired Containers, My Cart CswNbtView MyContainersView = _CswNbtSchemaModTrnsctn.restoreView( "My Containers", NbtViewVisibility.Global ); if( null != MyContainersView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = MyContainersView.ViewId.ToString(), NodeTypeId = String.Empty, Text = "My Containers", RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 1 }; LandingPageObj.addLandingPageItem(Request); } CswNbtView MyExpiredContainersView = _CswNbtSchemaModTrnsctn.restoreView( "My Expiring Containers", NbtViewVisibility.Global ); if( null != MyExpiredContainersView ) { Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "View", PkValue = MyExpiredContainersView.ViewId.ToString(), NodeTypeId = String.Empty, Text = "My Expiring Containers", RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 2 }; LandingPageObj.addLandingPageItem( Request ); } string SubmitRequestActionId = _CswNbtSchemaModTrnsctn.Actions[CswNbtActionName.Submit_Request].ActionId.ToString(); Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "Action", PkValue = SubmitRequestActionId, NodeTypeId = String.Empty, Text = "My Cart", RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 3 }; LandingPageObj.addLandingPageItem( Request ); RoleNode.postChanges( false ); } else if( RoleNode.Name.Text == "CISPro_Receiver" ) { //Actions - edit view, multi-edit, subscriptions _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Edit_View, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Multi_Edit, RoleNode, true ); _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Subscriptions, RoleNode, true ); //WelcomeItems - Create Material, search materials (requires restored search - not available yet)>>"Receive" string CreateMaterialActionId = _CswNbtSchemaModTrnsctn.Actions[CswNbtActionName.Create_Material].ActionId.ToString(); Request = new LandingPageData.Request { Type = CswNbtLandingPageItemType.Link, ViewType = "Action", PkValue = CreateMaterialActionId, NodeTypeId = String.Empty, Text = "Create Material", RoleId = RoleNode.NodeId.ToString(), ActionId = String.Empty, NewRow = 1, NewColumn = 1 }; LandingPageObj.addLandingPageItem( Request ); RoleNode.postChanges( false ); } } }//Update()
public override void update() { Int32 AdminRolePk = Int32.MinValue; CswCommaDelimitedString AdminRoles = new CswCommaDelimitedString(); // Change the visibilily of the 'Roles and Users' view to global CswNbtView RolesAndUsersView = _CswNbtSchemaModTrnsctn.restoreView( "Roles and Users" ); if( null != RolesAndUsersView ) { RolesAndUsersView.SetVisibility( CswEnumNbtViewVisibility.Global, null, null ); RolesAndUsersView.save(); // For any roles that aren't Administrator roles, remove any role permissions CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass ); foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true, false ) ) { if( CswEnumTristate.True != RoleNode.Administrator.Checked ) { foreach( CswEnumNbtNodeTypePermission Permission in CswEnumNbtNodeTypePermission.Members ) { RoleNode.NodeTypePermissions.RemoveValue( CswNbtObjClassRole.MakeNodeTypePermissionValue( RoleOC.FirstNodeType.NodeTypeId, Permission ) ); } RoleNode.NodeTypePermissions.SyncGestalt(); RoleNode.postChanges( false ); } else { AdminRoles.Add( CswConvert.ToString( RoleNode.NodeId.PrimaryKey ) ); } // We need this because setting the landing page for this Role is a special case if( RoleNode.Name.Text == "Administrator" ) { AdminRolePk = RoleNode.NodeId.PrimaryKey; } } // Redirect Welcome Landingpage items CswTableUpdate TableUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "updateLandingPageItems_Case28518", "landingpage" ); DataTable LandingPageDt = TableUpdate.getTable( "where for_roleid in (" + AdminRoles.ToString() + ")" ); foreach( DataRow CurrentRow in LandingPageDt.Rows ) { if( CswConvert.ToInt32( CurrentRow["for_roleid"] ) == AdminRolePk ) { if( CswConvert.ToString( CurrentRow["to_nodeviewid"] ) == "19" ) { CurrentRow["displaytext"] = RolesAndUsersView.ViewName; } } if( CswConvert.ToString( CurrentRow["displaytext"] ) == "Roles and Users" ) { CurrentRow["to_nodeviewid"] = RolesAndUsersView.ViewId.get(); } } TableUpdate.update( LandingPageDt ); }//if( null != RolesAndUsersView ) }// update()