| Link | admin_groupassigndatabase |
| Author | Jason Huck |
| Category | Administration |
| Version | 8.x |
| License | http://opensource.org/licenses/artistic-license.php |
| Posted | 21 Nov 2006 |
| Updated | 21 Nov 2006 |
| More by this author... | |
Assigns the specified database to the specified group. Requires authentication as a user with permissions on Lasso's internal db's, i.e., with [auth_admin].
admin_groupassigndatabase( -database='TestDB', -group='TestGroup' );
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag(
'groupassigndatabase',
-namespace='admin_',
-req='group',
-req='database',
-opt='perms',
-priority='replace',
-description='Assigns the specified database to the specified group.'
);
!local_defined('perms') ? local('perms' = 'I,S,A,U,D,X,Q');
inline( -database='lasso_internal', -sql='SELECT 1');
local('sql' = '
SELECT id
FROM security_groups
WHERE name = \'' + #group + '\'
');
inline( -sql=#sql);
local('groupID') = field('id');
/inline;
local('sql' = '
SELECT id
FROM security_datasource_databases
WHERE (alias IS NULL AND name = \'' + #database + '\')
OR alias = \'' + #database + '\'
');
inline( -sql=#sql);
local('dbID') = field('id');
/inline;
local('sql' = '
SELECT id
FROM security_group_db_map
WHERE id_database = ' + #dbID + '
AND id_group = ' + #groupID + '
');
protect;
inline( -sql=#sql);
if(found_count);
local('sql' = '
UPDATE security_group_db_map
SET allow = \'' + #perms + '\'
WHERE id = ' + field('id') + '
');
inline( -sql=#sql); /inline;
else;
local('sql' = '
INSERT INTO security_group_db_map (
id_database,
id_group,
allow
) VALUES (
' + #dbID + ',
' + #groupID + ',
\'' + #perms + '\'
)
');
inline( -sql=#sql); /inline;
/if;
/inline;
return(true);
handle_error;
return(false);
/handle_error;
/protect;
/inline;
/define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft