Skip to content

Commit

Permalink
Restrict some part of application based on new properties
Browse files Browse the repository at this point in the history
(reference #65)
  • Loading branch information
piotrzarzycki21 committed Nov 18, 2024
1 parent 234c37c commit 554d5a4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ package Super.Human.Portal_Royale.views.modules.DocumentationForm.DocumentationF

if (loginProxy.config)
{
this.editable = loginProxy.config.config.ui_documentation_editable;
this.editable = loginProxy.config.config.ui_documentation_editable && loginProxy.user && loginProxy.user.display.manageDocumentation;
this.showUnid = loginProxy.config.config.ui_documentation_show_unid;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ package controller
import org.apache.royale.collections.ArrayList;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
import model.proxy.login.ProxyLogin;

public class CommandRefreshNavigationBookmarks extends SimpleCommand
{
override public function execute(note:INotification):void
{
var bookmarks:Array = note.getBody() as Array;


var loginProxy:ProxyLogin = facade.retrieveProxy(ProxyLogin.NAME) as ProxyLogin;

var mainMediator:MediatorMainContentView = facade.retrieveMediator(MediatorMainContentView.NAME) as MediatorMainContentView;
var bookmarksProxy:ProxyBookmarks = facade.retrieveProxy(ProxyBookmarks.NAME) as ProxyBookmarks;

Expand Down Expand Up @@ -53,12 +56,17 @@ package controller
defaultItem = groups.splice(defaultIndex, 1);
}
}

groups.insertAt(0, {name: "Browse My Server"});

var initialGroupIndexItem:int = 0;
if (loginProxy.user.display.browseMyServer)
{
groups.insertAt(initialGroupIndexItem, {name: "Browse My Server"});
initialGroupIndexItem = 1;
}

if (defaultItem.length > 0)
{
groups.insertAt(1, defaultItem[0]);
groups.insertAt(initialGroupIndexItem, defaultItem[0]);
}

groups.forEach(function(group:Object, index:int, arr:Array):void{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ package controller.roles.executeRoles
var navItem:NavigationLinkVO = null;

//Remove "Additional directories" - avialable as admin
if (loginProxy.user && !loginProxy.user.hasRole(Roles.ADMINISTRATOR))
//&& !loginProxy.user.hasRole(Roles.ADMINISTRATOR)
if (loginProxy.user && !loginProxy.user.display.additionalGenesis)
{
for (var i:int = mainContentModel.mainNavigation.length - 1; i >= 0; i--)
{
Expand Down Expand Up @@ -63,6 +64,14 @@ package controller.roles.executeRoles
mainContentModel.navigationLinks.removeItemAt(k);
}
}

for (k = mainContentModel.mainNavigation.length - 1; k >= 0; k--)
{
navItem = mainContentModel.mainNavigation.getItemAt(k) as NavigationLinkVO;
if (navItem.idSelectedItem == MediatorGenesisApps.NAME) {
mainContentModel.mainNavigation.removeItemAt(k);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ package model.proxy.login
user.display.documentation = loginResult.display.documentation;
user.display.installApps = loginResult.display.installApps;
user.display.manageBookmarks = loginResult.display.manageBookmarks;
user.display.manageDocumentation = loginResult.display.manageDocumentation;
user.display.viewBookmarks = loginResult.display.viewBookmarks;
user.display.viewDocumentation = loginResult.display.viewDocumentation;
user.display.viewInstalledApps = loginResult.display.viewInstalledApps;
}
this.setData(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ package model.vo
_manageBookmarks = value;
}

private var _manageDocumentation:Boolean;

public function get manageDocumentation():Boolean
{
return _manageDocumentation;
}

public function set manageDocumentation(value:Boolean):void
{
_manageDocumentation = value;
}

private var _viewBookmarks:Boolean;

public function get viewBookmarks():Boolean
Expand All @@ -75,6 +87,18 @@ package model.vo
_viewBookmarks = value;
}

private var _viewDocumentation:Boolean;

public function get viewDocumentation():Boolean
{
return _viewDocumentation;
}

public function set viewDocumentation(value:Boolean):void
{
_viewDocumentation = value;
}

private var _viewInstalledApps:Boolean;

public function get viewInstalledApps():Boolean
Expand Down

0 comments on commit 554d5a4

Please sign in to comment.