Advertisement
Ruslan_Rayanov

Untitled

Nov 2nd, 2022
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2. ALTER PROCEDURE [dbo].[as_pg_getMenuPages]
  3. @username nvarchar(128),
  4. @onlyStartPanel bit,
  5. @langID int = 0
  6. AS
  7. BEGIN
  8.  
  9.  
  10. declare @roles table(role nvarchar(128))
  11. insert into @roles
  12. select role from dbo.sec_getuserRoles(@username)
  13.  
  14.  
  15. select pg_pages.id,
  16. isnull(as_lang_pages.title, pg_pages.title) title,
  17. menuPreTitle,
  18. isnull(as_lang_pages.description, pg_pages.description) description,
  19. pg_pages.code,
  20. pg_pages.isInMenu,
  21. pg_pages.ord,
  22. pg_pages.menuIcon,
  23. pg_pages.parentID,
  24. pg_pages.isStartPanel
  25. from pg_pages left join as_lang_pages on as_lang_pages.itemID = pg_pages.id and langID = @langID
  26. where
  27. [role]<>'all' and @username <>'' and
  28. (
  29. isinMenu='1' and exists(select value from dbo.split([role], ',') where value in (select role from @roles))
  30. and (@onlyStartpanel='0' or @onlyStartpanel='1' and isStartPanel='1' )
  31. )
  32. or ( [role]='all' and isinMenu='1' and @username='')
  33. or ( [role]='*' and isinMenu='1' and (select count(*) from @roles)>0)
  34. order by ord
  35.  
  36. END
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement