Community Alums
Not applicable

While working on a specific project, we had a requirement where resource managers should be able to confirm/allocate/reject only groups/users that they directly manage. I was surprised to not find anything on this matter, so I wanted to provide a solid solution.

 

To fully describe the requirement, we have to restrict the Resource Manager's ability to do CAR (Confirm/Allocate/Reject) actions - either this is from a resource plan record or from his Allocation Workbench.

find_real_file.png

 

 

 

This can be achieved by editing the Script Include called RMUIActionHelper:

find_real_file.png

 

 

 

The following functions determine the conditions for the CAR actions that are available to every user:

canConfirm: function() {
		return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.REQUESTED) && this.gr.getValue('plan_type') != 'operational_work';
},
	
canConfirmAndAllocate: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.REQUESTED) && this.gr.getValue('plan_type') != 'operational_work';
},
	
canAllocate: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.CONFIRMED || (this.gr.state == ResourcePlanState.ALLOCATION_IN_PROGRESS && this._allocationEventFailed()) || (this.gr.state == ResourcePlanState.REQUESTED && this.gr.getValue('plan_type') == 'operational_work'));
},
	
canReject: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.REQUESTED) && this.gr.getValue('plan_type') != 'operational_work';
},

 

 

By simply appending the condition "&& (this.gr.group_resource.manager.getValue()==gs.getUserID() || this.gr.user_resource.manager.getValue()==gs.getUserID())" at the end of each of the existing conditions we are effectively restricting the CAR actions to the resource managers that are managers of groups/users on the resource plan specified:

canConfirm: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.REQUESTED) && this.gr.getValue('plan_type') != 'operational_work' && (this.gr.group_resource.manager.getValue()==gs.getUserID() || this.gr.user_resource.manager.getValue()==gs.getUserID());
},
	
canConfirmAndAllocate: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.REQUESTED) && this.gr.getValue('plan_type') != 'operational_work' && (this.gr.group_resource.manager.getValue()==gs.getUserID() || this.gr.user_resource.manager.getValue()==gs.getUserID());
},
	
canAllocate: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.CONFIRMED || (this.gr.state == ResourcePlanState.ALLOCATION_IN_PROGRESS && this._allocationEventFailed()) || (this.gr.state == ResourcePlanState.REQUESTED && this.gr.getValue('plan_type') == 'operational_work')) && (this.gr.group_resource.manager.getValue()==gs.getUserID() || this.gr.user_resource.manager.getValue()==gs.getUserID());
},
	
canReject: function() {
	return gs.hasRole('resource_manager') && (this.gr.state == ResourcePlanState.REQUESTED) && this.gr.getValue('plan_type') != 'operational_work' && (this.gr.group_resource.manager.getValue()==gs.getUserID() || this.gr.user_resource.manager.getValue()==gs.getUserID());
},

 

 

 

Have in mind that this change only affects the CAR actions. The resource managers that are not direct managers of the User/Group, still have visibility on these resource plans.

 

If this article helped you, please mark it as helpful.

Comments
TroySasso
Tera Contributor

Will let you know if it works.  This should be a property out of box to enable/disable.

TroySasso
Tera Contributor

Worked like a charm.  How would I do this on the Capacity planning console as well?

Community Alums
Not applicable

I can't give you a step - by - step process, but you'll need to get your hands dirty with the widget. The Capacity Planning Console is a Portal Page with widgets. If you right-click and edit the list of Resource Plans as a widget, you can find in Client Controller a "refreshList" function that calls another fucntion (RPService.getPlans($scope.query, maxPlans)). As an input it passes the $scope.query that is provided by the filter widget. Although you can't edit the filter widget itself, you can add a line before the function call "RPService.getPlans($scope.query, maxPlans)" that gets the $scope.query and appends something like "'^group_resource.manager=' + gs.getUserID()" so that it always enforces that query on that.

My availability is negative at this time so this is all the help I can provide for now, hope it gives you a good head-start to begin testing.

Version history
Last update:
‎06-09-2022 12:09 AM
Updated by:
Community Alums