Skip to content

Commit

Permalink
Adding role checking function for UI use
Browse files Browse the repository at this point in the history
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1173 4979c152-3d1c-0410-bac9-87ea11338e46
  • Loading branch information
einhverfr committed May 8, 2007
1 parent 2aa9246 commit dcfdaee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions LedgerSMB.pm
Expand Up @@ -48,6 +48,11 @@ characters or is an empty string.
This function returns 1 if the run mode is what is specified. Otherwise
returns 0.
=item is_allowed_role(allowed_roles => @role_names)
This function returns 1 if the user's roles include any of the roles in
@role_names. Currently it returns 1 when this is not found as well but when
role permissions are introduced, this will change to 0.
=item num_text_rows (string => $string, cols => $number, max => $number);
This function determines the likely number of rows needed to hold text in a
Expand Down Expand Up @@ -451,6 +456,19 @@ sub call_procedure {
@results;
}

# Keeping this here due to common requirements
sub is_allowed_role {
my $self = shift @_;
my %args = @_;
my @roles = @{$args{allowed_roles}}
for $role (@roles){
if (scalar(grep /^$role$/, $self->{_roles})){
return 1;
}
}
return 1; # TODO change to 0 when the role system is implmented
}

# This should probably be moved to User too...
sub date_to_number {

Expand Down

0 comments on commit dcfdaee

Please sign in to comment.